/*
 * RiverFrameBackend.java
 * Team qq 2011
 */
package main.java.presenter.com.teamqq.timetrail;

import main.java.backend.com.teamqq.timetrail.Control;
import main.java.backend.com.teamqq.timetrail.River;

/**
 * A frame that allows for river crossing
 * PRECONDITION: the current place in Control must have a river crossing
 * @author Steven
 *
 */
public class RiverFrameBackend {

	/** The control object that gets important data from the back end **/
    private final Control gameControl;
		
    /** The River that this GUI shows to the player **/
    private final River currentRiver;
    
    public RiverFrameBackend(Control gameControl){
    	this.gameControl = gameControl;
    	this.currentRiver = new River(this.gameControl,this.gameControl.getCurrentPlace());
    }
    
    /**
     * 
     * @return The status of the river
     */
    public String riverStatus() {
			return "At " + gameControl.getCurrentPlace().getName() + " you encounter " + currentRiver.toString(); 
    }
    
    /**
     * 
     * @return The text that tells you that you have options
     */
    public String optionsText() {
    	return "You currently have only three options: ";
    }
    
    /**
     * 
     * @return the text associated with taking a ferry
     */
    public String ferryText() {
    	return "You can take the ferry which costs " + currentRiver.getFerryPrice() + " time dollars";
    }
    
    /**
     * 
     * @return the text associated with the option to caulk the ship and float
     */
    public String caulkText() {
    	return "You can Try and caulk the wagon and float downstream";
    }
    
    /**
     * 
     * @return the text associated with the option to ford the river
     */
    public String fordText() {
    	return "Or you can just choose to ford the time stream";
    }
    
    /**
     * 
     * @return the text on the confirm button
     */
    public String confirmText() {
    	return "Confirm";
    }
    
    /**
     * 
     * @return the text displayed if there is an error that happens during option selection
     */
    public String errorText() {
    	return "Problem Occured during option selection";
    }
    
    /**
     * 
     * @return the instance of the river that you are located
     */
    public River getRiver() {
    	return currentRiver;
    }

    /**
     * This is used to determine whether or not to show the option 
     * to take a ferry in the River event screen
     * 
     * @return whether or not to take the ferry
     */
	public boolean canTakeFerry() {
		return (gameControl.getInv().canRemoveItem(getRiver().getFerryPrice(), 
				gameControl.getInv().getMoney()));
	}
    
}
